<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
  'id'=>'product-categories-form',
  'enableAjaxValidation'=>false,
  'htmlOptions'=>array('enctype' => 'multipart/form-data')
)); ?>

  <p class="note">Fields with <span class="required">*</span> are required.</p>

  <?php echo $form->errorSummary($model); ?>

  <?
    $this->widget('zii.widgets.jui.CJuiTabs', array(
      'tabs'=>array(
        'English' =>$this->renderPartial('_formDetail', array('model' => $model, 'form' => $form, 'language' => 'en'), $this),
        'Thai'=>$this->renderPartial('_formDetail', array('model' => $model, 'form' => $form, 'language' => 'th'), $this),
      )
    ));
  ?>

  <?php if($model->subProductCategoriesCount==0) {?>
		<div class="row">
			<?php echo $form->labelEx($model,'main_product_category_id'); ?>
			<?php if($model->id) {
				echo $form->dropDownList($model,'main_product_category_id', CHtml::listData(ProductCategories::model()->findAll(array('condition' => 'main_product_category_id is null AND id !='. $model->id)), 'id', 'name'), array('empty' => '-- Main --'));
			}else {
				echo $form->dropDownList($model,'main_product_category_id', CHtml::listData(ProductCategories::model()->findAll(array('condition' => 'main_product_category_id is null')), 'id', 'name'), array('empty' => '-- Main --'));
			}?>
			<?php echo $form->error($model, 'main_product_category_id'); ?>
		</div>    
	<?php } ?>
	
	<?php if(isset($model->photo_path)) {
		echo CHtml::image($model->photo_path);
	}?>
	
	<div class="row">
  	<?php echo $form->labelEx($model,'photo_path'); ?>
  	<?php echo $form->fileField($model,'photo_path'); ?>
  	<?php echo $form->error($model,'photo_path'); ?>
  </div>
  

  <div class="row buttons">
    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
  </div>

<?php $this->endWidget(); ?>

</div><!-- form -->